home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2007 January, February, March & April
/
Chip-Cover-CD-2007-02.iso
/
Pakiet internetowy
/
Menedzery hasel
/
Mateyko 2.0
/
NetIDSetup.msi
/
_577F92E7A8A22FA500E912D074B5C998
/
_6E0A66E3CB02449CBB252E3C2447B3CA
/
install.js
next >
Wrap
Text File
|
2006-04-04
|
5KB
|
148 lines
// XpiInstaller
// By Pike (Heavily inspired by code from Henrik Gemal and Stephen Clavering)
var XpiInstaller = {
// --- Editable items begin ---
extFullName: 'Mateyko plugin', // The name displayed to the user (don't include the version)
extShortName: 'netidtoolbar', // The leafname of the JAR file (without the .jar part)
extVersion: '1.1',
extAuthor: 'focuscoding.com',
extLocaleNames: null, // e.g. ['en-US', 'en-GB']
extSkinNames: ['classic'], // e.g. ['classic', 'modern']
extPostInstallMessage: 'Success! Please restart your browser to finish the installation.', // Set to null for no post-install message
// --- Editable items end ---
profileInstall: true,
silentInstall: false,
install: function()
{
var jarName = this.extShortName + '.jar';
var profileDir = Install.getFolder('Profile', 'chrome');
var errResult = 0;
// Parse HTTP arguments
this.parseArguments();
// Check if extension is already installed in profile
if (File.exists(Install.getFolder(profileDir, jarName)))
{
if (!this.silentInstall)
{
Install.alert('Updating existing Profile install of ' + this.extFullName + ' to version ' + this.extVersion + '.');
}
this.profileInstall = true;
}
else if (!this.silentInstall)
{
// Ask user for install location, profile or browser dir?
this.profileInstall = Install.confirm('Install ' + this.extFullName + ' ' + this.extVersion + ' to your Profile directory (OK) or your Browser directory (Cancel)?');
}
// Init install
var dispName = this.extFullName + ' ' + this.extVersion;
var regName = '/' + this.extAuthor + '/' + this.extShortName;
errResult = Install.initInstall(dispName, regName, this.extVersion);
logComment("initInstall() result: " + errResult);
// Find directory to install into
var installPath;
if (this.profileInstall)
installPath = profileDir;
else
installPath = Install.getFolder('chrome');
// Add JAR file
errResult = Install.addFile(null, 'chrome/' + jarName, installPath, null);
logComment("addFile( jar ) result: " + errResult);
//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
// Add dll & xpt files
//var profileDirCOM = Install.getFolder('Profile', 'components');
//var installPathCOM;
//if (this.profileInstall) installPathCOM = profileDirCOM;
//else installPathCOM = Install.getFolder('components');
//alert( "Execute: " + execute( 'L_Caller.exe' ) );
var installPathCOM = Install.getFolder('components');
errResult = Install.addFile(null, 'components/NetIDCom.dll', installPathCOM, null);
logComment("addFile( dll ) result: " + errResult);
errResult = Install.addFile(null, 'components/INetIDCom.xpt', installPathCOM, null);
logComment("addFile( xpt ) result: " + errResult);
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
// Register chrome
var jarPath = Install.getFolder(installPath, jarName);
var installType = this.profileInstall ? Install.PROFILE_CHROME : Install.DELAYED_CHROME;
// Register content
errResult = Install.registerChrome(Install.CONTENT | installType, jarPath, 'content/' + this.extShortName + '/');
logComment("registerChrome( content ) result: " + errResult);
// Register locales
for (var locale in this.extLocaleNames)
{
var regPath = 'locale/' + this.extLocaleNames[locale] + '/' + this.extShortName + '/';
errResult = Install.registerChrome(Install.LOCALE | installType, jarPath, regPath);
logComment("registerChrome( locale ) result: " + errResult);
}
// Register skins
for (var skin in this.extSkinNames)
{
var regPath = 'skin/' + this.extSkinNames[skin] + '/' + this.extShortName + '/';
errResult = Install.registerChrome(Install.SKIN | installType, jarPath, regPath);
logComment("registerChrome( skin ) result: " + errResult);
}
// Perform install
var err = Install.performInstall();
logComment("performInstall() result: " + err);
if (err == Install.SUCCESS || err == Install.REBOOT_NEEDED)
{
if (!this.silentInstall && this.extPostInstallMessage)
{
Install.alert(this.extPostInstallMessage);
}
}
else
{
this.handleError(err);
return;
}
},
parseArguments: function()
{
// Can't use string handling in install, so use if statement instead
var args = Install.arguments;
if (args == 'p=0')
{
this.profileInstall = false;
this.silentInstall = true;
}
else if (args == 'p=1')
{
this.profileInstall = true;
this.silentInstall = true;
}
},
handleError: function(err)
{
if (!this.silentInstall)
{
Install.alert('Error: Could not install ' + this.extFullName + ' ' + this.extVersion + ' (Error code: ' + err + ')');
}
Install.cancelInstall(err);
}
};
XpiInstaller.install();